package explorer.abstractFactory.ConcreteFactory;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import explorer.abstractFactory.interfaces.IMusicIcon;

public class MusicIcon implements IMusicIcon{

	private BufferedImage blueImage;
	private BufferedImage purpleImage;
	private BufferedImage image;
	private String style= new String();

	
public MusicIcon(String style) {
		super();
		this.style = style;
	}


@Override
	public BufferedImage loadMusicImage() {
	
	if (style.equals("blue")){
		
		if(blueImage==null){
			
			try {
					blueImage=ImageIO.read(new File("iconsblue/Music.png"));
				} catch (IOException e) {
					e.printStackTrace();
			}
		}
		
	}else if(style.equals("purple")){
	
		if(purpleImage==null){
			
			try {
				purpleImage=ImageIO.read(new File("iconspurple/Music.png"));
			} catch (IOException e) {
						e.printStackTrace();
			}
		}
	
	}

	if(style.equals("blue")){
		
		image=blueImage;
	
	}else if(style.equals("purple")){
	
		image=purpleImage;
	
	}
	
	return image;
	}
}
